<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
    <link rel="stylesheet" href="../static/css/typo.css">
    <link rel="stylesheet" href="../static/css/animate.css">
    <link rel="stylesheet" href="../static/lib/prism/prism.css">
    <link rel="stylesheet" href="../static/css/me.css">
</head>
<body>
    <!-- 导航 -->
    <nav class="ui inverted attached segment m-shadow-small">
        <div class="ui container">
            <div class="ui inverted secondary stackable menu">
                <h2 class="ui teal header item">人生的过客</h2>
                <a href="#" th:href="@{/}" class="m-item item m-mobile-hide"><i class="mini home icon"></i>首页</a>
                <a href="#" th:href="@{/type}" class="m-item item m-mobile-hide"><i class="mini idea icon"></i>分类</a>
                <a href="#" th:href="@{/tag}" class="m-item item m-mobile-hide"><i class="mini tags icon"></i>标签</a>
                <a href="#" th:href="@{/archives}" class="m-item item m-mobile-hide"><i class="mini clone icon"></i>归档</a>
                <a href="#" th:href="@{/about}" class="m-item item m-mobile-hide"><i class="mini info icon"></i>关于我</a>
                <div class="right item">
                    <form name="search" action="#" th:action="@{/search}" method="post" target="_blank">
                        <div class="ui icon inverted transparent input">
                            <input type="text" name="query" placeholder="请输入你要搜索的内容">
                            <i onclick="document.forms['search'].submit()" class="search link icon"></i>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <a href="#" class="ui menu toggle black icon button m-top-right m-mobile-show">
            <i class="sidebar icon"></i>
        </a>
    </nav>

    <!-- 中间 -->
    <div class="m-container m-padded-tb-big m-container-small animated fadeIn">
        <div class="ui container">
            <!--头部-->
            <div class="ui top attached segment">
                <div class="ui horizontal link list">
                    <div class="item">
                        <img src="../static/images/touxiang.jpg" th:src="@{/images/touxiang.jpg}" alt="" class="ui avatar image">
                        <div class="content" ><a href="#" class="header" th:href="${blog.user.username}">人生的过客</a></div>
                    </div>
                    <div class="item">
                        <i class="calendar icon"></i> <span th:text="${#temporals.format(blog.updateTime, 'yyyy-MM-dd HH:mm')}">2017-10-01</span>
                    </div>
                    <!--  redis功能  -->
                    <!--<div class="item">-->
                        <!--<i class="eye icon"></i> <span th:text="${blog.pageViews}">0</span>-->
                    <!--</div>-->
                </div>
            </div>
            <!-- 博客大图区域  -->
            <div class="ui segment attached">
                <!--fluid作用是撑满segment的整个空间-->
                <img class="ui fluid image rounded" th:src="@{${blog.photo}}" src="https://rong-1257752702.cos.ap-chengdu.myqcloud.com/%E5%8D%9A%E5%AE%A2%E9%A1%B9%E7%9B%AE/1.jpg">
            </div>
            <!--内容-->
            <div class="ui  segment attached padded">
                <!--  显示flag -->
                <div class="ui right aligned basic segment">
                    <div class="ui label orange" th:text="${blog.flag}">原创</div>
                </div>
                <!--标题-->
                <h2 class="ui center aligned header" th:text="${blog.title}">关于刻意练习的清单</h2>
                <br>
                <!--博客内容-->
                <div id="content" class="typo typo-selection js-toc-content m-padded-lr-responsive m-padded-tb-large" th:utext="${blog.comtent}">

                </div>
                <!-- 标签 -->
                <div class="m-padded-lr-responsive">
                    <div class="ui basic teal left pointing label" th:each="tag : ${blog.tags}" th:text="${tag.name}">方法论</div>
                </div>

                <!--赞赏-->
                <div th:if="${blog.opengood}">
                    <div id="reward" class="ui center aligned segment basic ">
                        <button class="ui basic ui orange button circular">
                            赞赏
                        </button>
                    </div>

                    <!--js .class取的 pay-->
                    <div class="ui pay flowing popup top left transition hidden">
                        <div class="ui orange basic label">
                            <div class="ui images">
                                <div class="image" style="font-size: inherit !important;">
                                    <img src="../static/images/zhifubao.png" alt="" class="ui rounded bordered image" style="width: 120px">
                                    <div>支付宝</div>
                                </div>
                                <div class="image">
                                    <img src="../static/images/weixinzhifu.png" alt="" class="ui rounded bordered image" style="width: 120px">
                                    <div>微信</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- 个人信息 -->
            <div class="ui positive attached message" th:if="${blog.openstatement}">
                <!--grid进行左右布局-->
                <div class="ui middle aligned grid">
                    <!--左边11份-->
                    <div class="eleven wide column">
                        <li>作者：<span th:text="${blog.user.username}">人生的过客</span><a href="#" th:href="@{/about}" target="_blank">（联系作者）</a></li>
                        <li>发表时间：<span th:text="${#temporals.format(blog.createTime, 'yyyy-MM-dd HH:mm')}">2020-01-01 01:11</span></li>
                        <li>版权声明：自由转载-非商用-非衍生-保持署名（创意共享3.0许可证）</li>
                        <li>公众号转载：请在文末添加作者公众号二维码</li>
                    </div>
                    <!--右边5份-->
                    <div class="five wide column">
                        <!-- right floated 往右浮动-->
                        <img src="../static/images/weixin.jpg" th:src="@{/images/weixin.jpg}" class="ui bordered rounded image right floated" style="width: 110px">
                    </div>
                </div>
            </div>
            <!--留言信息-->
            <div class="ui attached bottom segment" th:if="${blog.opencomment}">
                <div id="comment-container" class="ui teal segment">

                    <div class="ui threaded comments" style="max-width: 100%;">
                            <h3 class="ui dividing header">评论</h3>
                            <div th:each="comment : ${comments}">
                                <div class="comment">
                                    <a class="avatar">
                                        <img src="https://unsplash.it/100/100?image=1005" th:src="@{${comment.avatar}}">
                                    </a>
                                    <div class="content">
                                        <a class="author" >
                                            <span th:text="${comment.username}">Matt</span>
                                            <!--<div class="ui mini basic teal left pointing label m-padded-mini" th:if="${comment.adminComment}">博主</div>-->
                                        </a>
                                        <div class="metadata">
                                            <span class="date" th:text="${#temporals.format(comment.createTime, 'yyyy-MM-dd HH:mm')}">Today at 5:42PM</span>
                                        </div>
                                        <div class="text" th:text="${comment.comtent}">
                                            How artistic!
                                        </div>
                                        <div class="actions">
                                            <a class="reply" data-parentidbyreply="1" data-commentusername="Matt" th:attr="data-parentidbyreply=${comment.parentId}, data-commentusername=${comment.username}, data-cid=${comment.id}" onclick="reply(this)">回复</a>
                                        </div>
                                    </div>

                                    <div th:each="items : *{soncomment}">
                                        <div th:each="item : ${items.value}" th:if="${comment.sonId != null}">

                                            <div th:if="${comment.sonId == item.parentId}">
                                                <div class="comments">
                                                    <div class="comment">
                                                        <a class="avatar">
                                                            <img src="https://unsplash.it/100/100?image=1005" th:src="@{${item.avatar}}">
                                                        </a>
                                                        <div class="content">
                                                            <a class="author"  th:text="${item.username}">Jenny Hess</a>
                                                            <div class="metadata">
                                                                <span class="date" th:text="${#temporals.format(item.createTime, 'yyyy-MM-dd HH:mm')}">Just now</span>
                                                            </div>
                                                            <div class="text" th:text="${item.comtent}">
                                                                Elliot you are always so right :)
                                                            </div>
                                                            <div class="actions">
                                                                <a class="reply" data-parentidbyreply="2" data-commentusername="Jenny Hess" th:attr="data-parentidbyreply=${item.parentId}, data-commentusername=${item.username}, data-cid=${item.id}" onclick="reply(this)">回复</a>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>

                                        </div>
                                    </div>

                                </div>
                            </div>
                        </div>

                    <form id="blog-form" action="#" th:action="@{/blog/submit}" method="post" class="ui form">
                        <div id="comment-form" class="ui form">
                            <input type="hidden" name="blogId" th:value="${blog.id}">
                            <input type="hidden" id="parentid" name="parentid" value="-1">
                            <input type="hidden" id="atname" name="atname" value="">
                            <input type="hidden" id="cid" name="cid" value="">
                            <div class="field">
                                <textarea name="comtent" placeholder="请输入评论信息..."></textarea>
                            </div>
                            <div class="fields">
                                <div class="field m-mobile-wide m-margin-bottom-small">
                                    <div class="ui left icon input">
                                        <i class="user icon"></i>
                                        <input type="text" name="username" placeholder="姓名">
                                    </div>
                                </div>
                                <div class="field m-mobile-wide m-margin-bottom-small">
                                    <div class="ui left icon input">
                                        <i class="mail icon"></i>
                                        <input type="text" name="email" placeholder="邮箱">
                                    </div>
                                </div>
                                <div class="field  m-margin-bottom-small m-mobile-wide">
                                    <button type="submit" class="ui teal button m-mobile-wide"><i class="edit icon"></i>发布</button>
                                </div>
                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>
    <!-- 全局按钮 -->
    <div class="m-fixed m-right-bottom m-padded-tiny">
        <div class="ui vertical icon buttons">
            <a href="#comment-container" class="ui teal button">留言</a>
            <button class="ui wechat icon button"><i class="weixin icon"></i></button>
            <a href="#" class="ui icon button"><i class="chevron up icon"></i></a>
        </div>
    </div>
    <div class="ui wechat-qr flowing popup transition hidden m-padded-mini" style="width: 130px;">
        <img src="../static/images/weixin.jpg" th:src="@{/images/weixin.jpg}" alt="" class="ui rounded image" style="width: 110px">
    </div>

    <br>
    <br>
    <br>

    <!--底部footter-->
    <footer class="ui inverted vertical segment m-padded-tb-massive">
        <div class="ui center aligned container">
            <div class="ui inverted divided stackable grid">
                <div class="three wide column">
                    <div class="ui inverted link list">
                        <div class="item">
                            <img src="../static/images/weixin.jpg" class="ui rounded image" alt="" style="width: 110px">
                        </div>
                    </div>
                </div>
                <div class="three wide column">
                    <h4 class="ui inverted header m-text-thin m-text-spaced ">最新博客</h4>
                    <div class="ui inverted link list">
                        <a href="#" class="item">用户故事(User Story)</a>
                        <a href="#" class="item">关键刻意练习的清单失败要趁早</a>
                    </div>
                </div>
                <div class="four wide column">
                    <h4 class="ui inverted header m-text-thin m-text-spaced ">联系我</h4>
                    <div class="ui inverted link list">
                        <a href="#" class="item">Email：1454713866@qq.com</a>
                        <a href="#" class="item">QQ:1454713866</a>
                        <a href="https://blog.csdn.net/li22356/article/details/109578226" class="item">CSDN:无语，人生的过客</a>
                    </div>
                </div>
                <div class="six wide column">
                    <h4 class="ui inverted header m-text-thin m-text-spaced ">人生的过客</h4>
                    <div class="ui inverted link list">
                        <p class="m-text-thin m-text-spaced m-opacity-mini">这是我的个人博客，会分享关于编程、写作、思考相关的任何内容，希望可以给来到这儿的人有所帮助.........</p>
                    </div>
                </div>
            </div>
            <div class="ui inverted section divider "></div>
            <p class="m-text-thin m-text-spaced m-opacity-tiny" >Copyright ⓒ 2019 - 2020 WuYuRenShengDeGuoKe Designed by WuYuRenShengDeGuoKe</p>
        </div>
    </footer>

        <script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
        <script src="../static/lib/prism/prism.js" th:src="@{/lib/prism/prism.js}"></script>
        <script src="../static/lib/tocbot/tocbot.min.js" th:src="@{/lib/tocbot/tocbot.min.js}"></script>
        <script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>


    <script type="text/javascript">
        $('.menu.toggle').click(function () {
            $('.m-item').toggleClass('m-mobile-hide');
        });

        $("#reward").popup({
            popup : $(".pay"),
            on: 'click',
            position : 'bottom center'
        });
        $('.toc.button').popup({
            popup : $(".toc-container.popup"),
            on: 'click',
            position : 'left center'
        });

        $('.wechat').popup({
            popup : $('.wechat-qr'),
            position: 'left center'
        });

        //评论表单验证
        $('.ui.form').form({
            fields: {
                title: {
                    identifier: 'comtent',
                    rules: [{
                        type: 'empty',
                        prompt: '请输入评论内容'
                    }
                    ]
                },
                content: {
                    identifier: 'username',
                    rules: [{
                        type: 'empty',
                        prompt: '请输入你的名字'
                    }]
                },
                type: {
                    identifier: 'email',
                    rules: [{
                        type: 'email',
                        prompt: '请填写正确的邮箱地址'
                    }]
                }
            }
        });
        
        function reply(obj) {
            var parentidbyreply = $(obj).data('parentidbyreply');
            var commentusername = $(obj).data('commentusername');
            var commentid = $(obj).data('cid');
            $("[name = 'comtent']").attr("placeholder", "@"+commentusername).focus();
            $("[id = 'parentid']").attr("value", parentidbyreply);
            $("[id = 'atname']").attr("value", commentusername);
            $("[id = 'cid']").attr("value", commentid);

            $(window).scrollto($('#comment-form'), 500);
        }

    </script>
</body>
</html>